package com.sunwayhorizo.health.platform.security.dao.impl;

import javax.ejb.Stateless;

import org.jboss.seam.annotations.Name;

import com.sunwayhorizo.health.platform.base.BaseManager;
import com.sunwayhorizo.health.platform.security.dao.SecurityAccountRoleDao;

@Stateless
@Name("SecurityAccountRoleDao")
public class SecurityAccountRoleImpl extends BaseManager implements SecurityAccountRoleDao{

	@Override
	public void deleteSecurityAccountByRoleId(String roleId) {
		super.entityManager2.createQuery("delete from SecurityAccountRole sar where sar.role.roleId = :roleId").setParameter("roleId", roleId).executeUpdate();
		super.flushClear(entityManager2);
	}

	@Override
	public void deleteSecurityRoleByAccountId(String accountId) {
		super.entityManager2.createQuery("delete from SecurityAccountRole sar where sar.account.accountId = :accountId").setParameter("accountId", accountId).executeUpdate();
		super.flushClear(entityManager2);
	}
}